<div class="form ">


    <?php
    $form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
        'type' => 'horizontal',
        'id' => 'reporte-form',
        'enableAjaxValidation' => false,
        'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false,),
        'enableClientValidation' => true,
        'htmlOptions' => array('class' => 'narrow'),
    ));
    ?>


    <h4><i class="icon-phone"></i> REPORTE DE VENTAS PIE
    </h4>
    <div class="widget-body">
        <?php echo $form->errorSummary($model) ?>

        <div class="row-fluid controles">

            <div class="span6">
                <?php // echo $form->dropDownListRow($model, 'evento', array('' => ' -- Seleccione -- ') + CHtml::listData(Evento::model()->de_carrera($carrera_id)->findAll(), 'id', Evento::representingColumn())) ?>

                <?php // $eventosLista= CHtml::listData(Evento::model()->de_carrera($carrera_id)->findAll(), 'id', Evento::representingColumn()); ?>

                <div class="control-label required ">Filtro <span class="required">*</span></div>
                <?php
                $this->widget('bootstrap.widgets.TbDateRangePicker', array(
                    'model' => $model,
                    'attribute' => 'fechas',
                    'options' => array(
                        'format' => 'dd/MM/yyyy',
                        'ranges' => array(
                            'Hoy' => array('today', 'today'),
                            'Ayer' => array('yesterday', 'yesterday'),
                            'Semana actual' => array('monday', 'today'),
                            'Semana Anterior' => array(Util::calcularSemanaAnterior(0), Util::calcularSemanaAnterior(1)),
                            'Mes Actual' => array(Util::obtenerPrimerDiaMes(), Util::obtenerUltimoDiaMes()),
                            'Mes Anterior' => array(Util::calcularMesAnterior(0), Util::calcularMesAnterior(1)),
                        )
                    ),
                    'htmlOptions' => array(
                        'readonly' => true,
                        'class' => 'hasDatepicker'
                    ),
                ));
                ?>

            </div>
            <div class="span6">

                <?php
                $this->widget('bootstrap.widgets.TbButton', array(
                    'buttonType' => 'submit',
                    'type' => 'primary',
                    'label' => Yii::t('AweCrud.app', 'Generar Reporte'),
                    'htmlOptions' => array(
                        'style' => 'display:inline-block'
                    )
                ));
                ?>
            </div>





        </div>


        <?php if ($piereport): ?> 

            <?php
            ?> 
            <div class="row-fluid">


                <!--                <div class="row-fluid span6" id="reportepie">
                <?php
//                    $this->Widget('ext.highcharts.HighchartsWidget', array(
//                        'scripts' => array(
//                            'modules/exporting', // adds Exporting button/menu to chart
//                        ),
//                        'options' => $piereport
//                    ));
                ?>
                                </div>-->
            </div>


            <div class="row-fluid" id="reportebarras">

                <?php
                $this->Widget('ext.highcharts.HighchartsWidget', array(
                    'scripts' => array(
                        'modules/exporting', // adds Exporting button/menu to chart
                    ),
                    'options' => $piereport
                ));

//                $this->widget('ext.highcharts.HighchartsWidget', array(
//                    'options' => array(
//                        'chart' => array(
//                            'type' => 'pie',
//                            'options3d' => array(
//                                'enabled' => true,
//                                'alpha' => 45,
//                                'beta' => 0
//                            )
//                        ),
//                        'tooltip' => array(
//                            'pointFormat' => '{series.name}: <b>{point.percentage:.1f}%</b>'
//                        ),
//                        'plotOptions' => array(
//                            'pie' => array(
//                                'allowPointSelect' => true,
//                                'cursor' => 'pointer',
//                                'depth' => 35,
//                                'dataLabels' => array(
//                                    'enabled' => true,
//                                    'format' => '{point.name}'
//                                )
//                            )
//                        ),
//                        'series' => array(array(
//                                'type' => 'pie',
//                                'data' => array(
//                                    array('Firefox', 44.2),
//                                    array('IE7', 26.6),
//                                    array('IE6', 20),
//                                    array('Chrome', 3.1),
//                                    array('Other', 5.4)
//                                )
//                            ))
//                    )
//                ));
                ?>
            </div>
        <?php elseif (!$visualizarReporte && !empty($model->fechas)): ?>

            <div class="span12"></div>
            <div class="row-fluid"></div>
            <div class="alert alert-block alert-info fade in">
                <center>
                    <h4 class="alert-heading">Alerta!</h4>
                    <p>
                        No existen datos entre las fechas indicadas
                    </p>
                </center>
            </div>


        <?php endif; ?>
    </div>
</div>

<?php $this->endWidget(); ?>


